package com.walle.concurrenttest.pattern.singlethreadexecute;

/**
 * @author zhangjiapeng
 * @Package com.walle.concurrenttest.pattern.singlethreadexecute
 * @Description: ${todo}
 * @date 2019/2/18 11:04
 */
public class UserThread implements Runnable {

    private String name;

    private Gate gate;

    public UserThread(String name, Gate gate) {
        this.name = name;
        this.gate = gate;
    }

    @Override
    public void run() {
        while (true){
            try {
                gate.pass(name);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
